<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="renderer" content="webkit">
<title>铁水联运信息核查系统--编辑申请明细</title>
	<link rel="shortcut icon" href="${mainDomain}/statics/images/favicon.ico">
    <link rel="stylesheet" href="${mainDomain}/statics/css/front/amazeui.min.css"/>
  	<link rel="stylesheet" href="${mainDomain}/statics/css/front/admin.css">
    <link rel="stylesheet" media="screen" href="${mainDomain}/statics/css/front/bootstrap.min.css" >
    <link rel="stylesheet" media="screen" href="${mainDomain}/statics/css/front/bootstrap-datetimepicker.min.css" >
    <script type="text/javascript">
        var mainDomain = "${mainDomain}";
		var miscDomain = '${mainDomain}';
    </script>
</head>
<body>
<#include "common/memberheader.ftl" />
<div class="am-cf admin-main">
	<#include "common/memberleft.ftl" />
	<!-- content start -->
<div class="admin-content">
    <div class="admin-content-body">
        <div class="am-cf am-padding am-padding-bottom-0">
            <div class="am-fl am-cf">
                <strong class="am-text-primary am-text-lg">编辑申请明细</strong>
            </div>
        </div>
 
        <hr>


        <form id="my-form" class="am-form" action="javascript:;" method="post" data-am-validator>
        	<input type="hidden" id="mxid" name="id" value="${(sbmxinfoModel.id)!''}"/>
        	<input type="hidden" id="hzdh" name="hzdh" value="${(sbmxinfoModel.hzdh)!''}"/>
        	<div class="am-g am-margin-top">
                <div class="am-u-sm-4 am-u-md-2 am-text-right">
                    运输类型
                </div>
                <div class="am-u-sm-8 am-u-md-4 am-form-group am-u-end">
                	<input type="hidden" id="yslxhid" value="${(sbmxinfoModel.yslx)!''}"/>
                    <select id="yslx" name="yslx">
                    	<option value="1">铁水</option>
                    	<option value="2">水铁</option>
                    </select>
                </div>
            </div>
        	
			<div class="am-g am-margin-top">
                <div class="am-u-sm-4 am-u-md-2 am-text-right">
                    箱号
                </div>
                <div class="am-u-sm-8 am-u-md-4 am-form-group">
                    <input type="text" id="xh" name="xh" value="${(sbmxinfoModel.xh)!''}" maxlength="20" class="am-input-sm" placeholder="请输入箱号" data-validation-message="请输入箱号" required/>
                </div>
                <div class="am-u-sm-12 am-u-md-6 am-text-danger" id="xh_tips">＊ 必填</div>
            </div>
            
            <div class="am-g am-margin-top">
                <div class="am-u-sm-4 am-u-md-2 am-text-right">
                    货物类型
                </div>
                <div class="am-u-sm-8 am-u-md-4 am-form-group am-u-end">
                	<input type="hidden" id="hwlxhid" value="${(sbmxinfoModel.hwlx)!''}"/>
                    <select name="hwlx" id="hwlx">
                    	<#list hwlxlist as info>            	
                        	<option value="${info.id}">${info.hwlxmc}</option>
                    	</#list>
                    </select>
                </div>
            </div>
            
            <!--<div class="am-g am-margin-top">
                <div class="am-u-sm-4 am-u-md-2 am-text-right">
                    货物名称
                </div>
                <div class="am-u-sm-8 am-u-md-4 am-form-group">
                    <input type="text" id="hwmc" name="hwmc" value="${(sbmxinfoModel.hwmc)!''}" maxlength="20" class="am-input-sm" placeholder="请输入货物名称" data-validation-message="请输入货物名称" required/>
                </div>
                <div class="am-u-sm-12 am-u-md-6 am-text-danger" id="hwmc_tips">＊ 必填</div>
            </div>-->
            
            <div class="am-g am-margin-top">
                <div class="am-u-sm-4 am-u-md-2 am-text-right">
                   箱型
                </div>
                <div class="am-u-sm-8 am-u-md-4 am-form-group am-u-end">
                	<input type="hidden" id="xxhid" value="${(sbmxinfoModel.xx)!''}"/>
                    <select name="xx" id="xx">
                    	<#list xxlist as info>            	
                        	<option value="${info.id}">${info.xxmc}</option>
                    	</#list>
                    </select>
                </div>
            </div>
            
            <div class="am-g am-margin-top">
                <div class="am-u-sm-4 am-u-md-2 am-text-right">
                    出/入铁路站场时间
                </div>
                <div class="am-u-sm-8 am-u-md-4">
                    <div class="am-form-group am-form-icon">
                        <i class="am-icon-calendar"></i>
                        <input id="crtlsj" name="crtlsj" value="${sbmxinfoModel.crtlsj?string('yyyy-MM-dd')}" type="text" class="am-form-field am-input-sm" readonly required
                               placeholder="出/入铁路站场时间"
                               data-am-datepicker="{format: 'yyyy-mm-dd'}">
                    </div>
                </div>
                <div class="am-u-sm-12 am-u-md-6 am-text-danger">＊ 必填</div>
            </div>
            
            <div class="am-g am-margin-top">
                <div class="am-u-sm-4 am-u-md-2 am-text-right">
                    铁路货票号
                </div>
                <div class="am-u-sm-8 am-u-md-4 am-form-group">
                    <input type="text" id="tlhph" name="tlhph" value="${(sbmxinfoModel.tlhph)!''}" maxlength="20" class="am-input-sm" placeholder="请输入 铁路货票号" data-validation-message="请输入 铁路货票号" required/>
                </div>
                <div class="am-u-sm-12 am-u-md-6 am-text-danger" id="tlhph_tips">＊ 必填</div>
            </div>
            
            <div class="am-g am-margin-top">
                <div class="am-u-sm-4 am-u-md-2 am-text-right">
                   发站
                </div>
                <div class="am-u-sm-8 am-u-md-4 am-form-group am-u-end">
                	<input type="hidden" id="fzhid" value="${(sbmxinfoModel.fz)!''}"/>
                    <select name="fz" id="fz">
                    	<#list zdlist as info>            	
                        	<option value="${info.id}">${info.zdmc}</option>
                    	</#list>
                    </select>
                </div>
            </div>
            
            <div class="am-g am-margin-top">
                <div class="am-u-sm-4 am-u-md-2 am-text-right">
                  到站
                </div>
                <div class="am-u-sm-8 am-u-md-4 am-form-group am-u-end">
                	<input type="hidden" id="dzhid" value="${(sbmxinfoModel.dz)!''}"/>
                    <select name="dz" id="dz">
                    	<#list zdlist as info>            	
                        	<option value="${info.id}">${info.zdmc}</option>
                    	</#list>
                    </select>
                </div>
            </div>
            
            <div class="am-g am-margin-top">
                <div class="am-u-sm-4 am-u-md-2 am-text-right">
                    出/入港口时间
                </div>
                <div class="am-u-sm-8 am-u-md-4">
                    <div class="am-form-group am-form-icon">
                        <i class="am-icon-calendar"></i>
                        <input id="crgksj" name="crgksj" value="${sbmxinfoModel.crgksj?string('yyyy-MM-dd')}" type="text" class="am-form-field am-input-sm" readonly required
                               placeholder="出/入港口时间"
                               data-am-datepicker="{format: 'yyyy-mm-dd'}">
                    </div>
                </div>
                <div class="am-u-sm-12 am-u-md-6 am-text-danger">＊ 必填</div>
            </div>
            
            <div class="am-g am-margin-top">
                <div class="am-u-sm-4 am-u-md-2 am-text-right">
                    货物运单号
                </div>
                <div class="am-u-sm-8 am-u-md-4 am-form-group">
                    <input type="text" id="hwydh" name="hwydh" value="${(sbmxinfoModel.hwydh)!''}" maxlength="20" class="am-input-sm" placeholder="请输入货物运单号" data-validation-message="请输入货物运单号" required/>
                </div>
                <div class="am-u-sm-12 am-u-md-6 am-text-danger" id="hwydh_tips">＊ 必填</div>
            </div>
            
            <!--<div class="am-g am-margin-top">
                <div class="am-u-sm-4 am-u-md-2 am-text-right">
                    封号
                </div>
                <div class="am-u-sm-8 am-u-md-4 am-form-group am-u-end">
                    <input type="text" id="fh" name="fh" value="${(sbmxinfoModel.fh)!''}" maxlength="20" class="am-input-sm" placeholder="请输入封号" data-validation-message="请输入封号" />
                </div>
            </div>
            
            <div class="am-g am-margin-top">
                <div class="am-u-sm-4 am-u-md-2 am-text-right">
                    海关监管明细表
                </div>
                <div class="am-u-sm-8 am-u-md-4 am-form-group am-u-end">
                    <input type="text" id="hgjgmx" name="hgjgmx" value="${(sbmxinfoModel.hgjgmx)!''}" maxlength="200" class="am-input-sm" placeholder="请输入海关监管明细" data-validation-message="请输入海关监管明细" />
                </div>
            </div>-->
            
            <div class="am-g am-margin-top">
                <div class="am-u-sm-4 am-u-md-2 am-text-right">
                    船名
                </div>
                <div class="am-u-sm-8 am-u-md-4 am-form-group">
                    <input type="text" id="cm" name="cm" value="${(sbmxinfoModel.cm)!''}" maxlength="20" class="am-input-sm" placeholder="请输入船名" data-validation-message="请输入船名" required/>
                </div>
                <div class="am-u-sm-12 am-u-md-6 am-text-danger" id="cm_tips">＊ 必填</div>
            </div>
            
            <div class="am-g am-margin-top">
                <div class="am-u-sm-4 am-u-md-2 am-text-right">
                    航次
                </div>
                <div class="am-u-sm-8 am-u-md-4 am-form-group">
                    <input type="text" id="hc" name="hc" value="${(sbmxinfoModel.hc)!''}" maxlength="15" class="am-input-sm" placeholder="请输入航次" data-validation-message="请输入航次" required/>
                </div>
                <div class="am-u-sm-12 am-u-md-6 am-text-danger" id="hc_tips">＊ 必填</div>
            </div>
            
            <div class="am-g am-margin-top">
                <div class="am-u-sm-4 am-u-md-2 am-text-right">
       MMSI号
                </div>
                <div class="am-u-sm-8 am-u-md-4 am-form-group am-u-end">
                    <input type="text" id="mmsi" name="mmsi" value="${(sbmxinfoModel.mmsi)!''}" maxlength="20" class="am-input-sm" placeholder="请输入MMSI号" data-validation-message="请输入MMSI号"/>
                </div>
            </div>
            
            <div class="am-g am-margin-top">
                <div class="am-u-sm-4 am-u-md-2 am-text-right">
                  船舶到港
                </div>
                <div class="am-u-sm-8 am-u-md-4 am-form-group am-u-end">
                	<input type="hidden" id="cbdghid" value="${(sbmxinfoModel.cbdg)!''}"/>
                    <select name="cbdg" id="cbdg">
                    	<#list gklist as info>            	
                        	<option value="${info.id}">${info.gkmc}</option>
                    	</#list>
                    </select>
                </div>
            </div>
            
            <div class="am-g am-margin-top">
                <div class="am-u-sm-4 am-u-md-2 am-text-right">
                  船舶离港
                </div>
                <div class="am-u-sm-8 am-u-md-4 am-form-group am-u-end">
                	<input type="hidden" id="cblghid" value="${(sbmxinfoModel.cblg)!''}"/>
                    <select name="cblg" id="cblg">
                    	<#list gklist as info>            	
                        	<option value="${info.id}">${info.gkmc}</option>
                    	</#list>
                    </select>
                </div>
            </div>
            
            <div class="am-g am-margin-top">
                <div class="am-u-sm-4 am-u-md-2 am-text-right">
       	海关申报单号
                </div>
                <div class="am-u-sm-8 am-u-md-4 am-form-group am-u-end">
                    <input type="text" id="hgsbdh" name="hgsbdh" value="${(sbmxinfoModel.hgsbdh)!''}" maxlength="20" class="am-input-sm" placeholder="请输入海关申报单号" data-validation-message="请输入海关申报单号" />
                </div>
            </div>
            
            <div class="am-g am-margin-top">
                <div class="am-u-sm-4 am-u-md-2 am-text-right">
       	铁路图片名称
                </div>
                <div class="am-u-sm-8 am-u-md-4 am-form-group am-u-end">
                    <input type="text" id="tlzpmc" name="tlzpmc" value="${(sbmxinfoModel.tlzpmc)!''}" maxlength="100" class="am-input-sm" placeholder="请输入铁路图片名称" data-validation-message="请输入铁路图片名称" />
                </div>
            </div>
            
            <div class="am-g am-margin-top">
                <div class="am-u-sm-4 am-u-md-2 am-text-right">
       	水路图片名称
                </div>
                <div class="am-u-sm-8 am-u-md-4 am-form-group am-u-end">
                    <input type="text" id="slzpmc" name="slzpmc" value="${(sbmxinfoModel.slzpmc)!''}" maxlength="100" class="am-input-sm" placeholder="请输入水路图片名称" data-validation-message="请输入水路图片名称" />
                </div>
            </div>
            
            <div class="am-g am-margin-top">
                <div class="am-u-sm-4 am-u-md-2 am-text-right">
       	海关图片名称
                </div>
                <div class="am-u-sm-8 am-u-md-4 am-form-group am-u-end">
                    <input type="text" id="hgzpmc" name="hgzpmc" value="${(sbmxinfoModel.hgzpmc)!''}" maxlength="100" class="am-input-sm" placeholder="请输入海关图片名称" data-validation-message="请输入海关图片名称" />
                </div>
            </div>
            
            <div class="am-g am-margin-top">
                <div class="am-u-sm-4 am-u-md-2 am-text-right">
       	备注
                </div>
                <div class="am-u-sm-8 am-u-md-4 am-form-group am-u-end">
                    <input type="text" id="bz" name="bz" value="${(sbmxinfoModel.bz)!''}" maxlength="11" class="am-input-sm" placeholder="请输入备注" data-validation-message="请输入备注" />
                </div>
            </div>

            <div class="am-margin">
                <button type="submit" id="saveButton" class="am-btn am-btn-primary am-btn-xs">提交保存</button>
            </div>
        </form>

    </div>
</div>
<!-- content end -->

</div>
</div>
<a href="#" class="am-icon-btn am-icon-th-list am-show-sm-only admin-menu"
   data-am-offcanvas="{target: '#admin-offcanvas'}"></a>
<#include "common/memberfooter.ftl" />
</div>
	<script type="text/javascript" src="${mainDomain}/statics/js/front/jquery-1.9.1.min.js"></script>
	<script type="text/javascript" src="${mainDomain}/statics/js/front/amazeui.min.js"></script>
	<script type="text/javascript" src="${mainDomain}/statics/js/front/ajaxfileupload.js"></script>
	
	<script>
	$(function() {
		var yslx = $('#yslxhid').val();
		var hwlx = $('#hwlxhid').val();
		var xx = $('#xxhid').val();
		var fz = $('#fzhid').val();
		var dz = $('#dzhid').val();
		var cbdg = $('#cbdghid').val();
		var cblg = $('#cblghid').val();
		
		$('#yslx').val(yslx);
		$('#hwlx').val(hwlx);
		$('#xx').val(xx);
		$('#fz').val(fz);
		$('#dz').val(dz);
		$('#cbdg').val(cbdg);
		$('#cblg').val(cblg);
	})
	
	$('#my-form').validator(
    {
        validate: function (validity) {
        	
            if ($(validity.field).is('#xh')) {
			    var xh=$("#xh").val();
				if(xh==""||xh==null||xh.length>20){
					validity.valid = false;
					$('#xh_tips').html("箱号必须输入小于20位字符");
				}else{
			    	validity.valid = true;
                    $('#xh_tips').html("");
			    }
        	}
        	
        	if ($(validity.field).is('#hwmc')) {
			    var hwmc=$("#hwmc").val();
				if(hwmc==""||hwmc==null||hwmc.length>20){
					validity.valid = false;
					$('#hwmc_tips').html("货物名称必须输入小于20位字符");
				}else{
			    	validity.valid = true;
                    $('#hwmc_tips').html("");
			    }
        	}
        	
        	if ($(validity.field).is('#tlhph')) {
			    var tlhph=$("#tlhph").val();
				if(tlhph==""||tlhph==null||tlhph.length>20){
					validity.valid = false;
					$('#tlhph_tips').html("铁路货票号必须输入小于20位字符");
				}else{
			    	validity.valid = true;
                    $('#tlhph_tips').html("");
			    }
        	}
        	
        	if ($(validity.field).is('#hwydh')) {
			    var hwydh=$("#hwydh").val();
				if(hwydh==""||hwydh==null||hwydh.length>20){
					validity.valid = false;
					$('#hwydh_tips').html("货物运单号必须输入小于20位字符");
				}else{
			    	validity.valid = true;
                    $('#hwydh_tips').html("");
			    }
        	}
        	
        	if ($(validity.field).is('#hwydh')) {
			    var hwydh=$("#hwydh").val();
				if(hwydh==""||hwydh==null||hwydh.length>20){
					validity.valid = false;
					$('#hwydh_tips').html("货物运单号必须输入小于20位字符");
				}else{
			    	validity.valid = true;
                    $('#hwydh_tips').html("");
			    }
        	}
        },
        
        submit: function() {
        	if(this.isFormValid()){
        		var formData = $('#my-form').serialize();
				$.ajax( {  
			        type : 'POST',  
			        url : '/btsb/editmx',  
			        data : formData,
			        dataType: "json",
			        success : function(data) {  
			        	var status = data.status;
			        	if(status==0){
			        		alert("更新成功!");
			        		var hzdh = $('#hzdh').val();
				        	window.location.href="/btsb/mxlistindex?hzdh="+ hzdh;
			        	}
			        },  
			        error : function(data) {  
			          console.log(data); 
			        }  
			      });
        }
        }
    })
	</script>
</body>
</html>
